package controller

import (
	"hft/Database/admin"
	services "hft/Http/Services"
	utils "hft/Http/Utils"

	"github.com/gin-gonic/gin"
)

type Params struct{}

func (*Params) GetParams(c *gin.Context) {

	data, err := services.ParamsService.GetParams()

	if err != nil {
		utils.FailWithMessage(err.Error(), c)
		return
	}

	utils.OkWithData(data, c)

}

func (*Params) CreateParams(c *gin.Context) {
	var res *admin.Params

	c.ShouldBindJSON(&res)

	err := services.ParamsService.CreateParams(res)

	if err != nil {
		utils.FailWithMessage(err.Error(), c)
		return
	}

	utils.Ok(c)
}

var ParamsController = new(Params)
